{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{} <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "dict = {}\n",
    "print(dict, type(dict))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'btc': 1997, 'ltc': '莱特币', 'eth': '完全不了解', 'fff': 9999999}\n",
      "1997\n"
     ]
    }
   ],
   "source": [
    "# 没有顺序，key不可以重复，key：value 元素类型可以不同\n",
    "dict = {\n",
    "    'btc' : 1997,\n",
    "    'ltc' : '莱特币',\n",
    "    'eth' : '完全不了解',\n",
    "    'fff' : 9999999\n",
    "}\n",
    "print(dict)\n",
    "print(dict['btc'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'btc': 1997, 'ltc': '莱特币', 'eth': '完全不了解', 'fff': 9999999, 'new_key': 'new_value'}\n",
      "{'btc': 1997, 'ltc': '莱特币', 'eth': '完全不了解', 'fff': 9999999, 'new_key': 'new_value_222'}\n"
     ]
    }
   ],
   "source": [
    "# 增加一个key-value\n",
    "dict['new_key'] = 'new_value'\n",
    "print(dict)\n",
    "dict['new_key'] = 'new_value_222'\n",
    "print(dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n",
      "dict_keys(['btc', 'ltc', 'eth', 'fff', 'new_key'])\n",
      "dict_values([1997, '莱特币', '完全不了解', 9999999, 'new_value_222'])\n"
     ]
    }
   ],
   "source": [
    "print('btc' in dict)\n",
    "print(dict.keys())\n",
    "print(dict.values())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
